// pages/userinfo/userinfo.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    userInfo: {}
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this
    wx.getSetting({
      success: function(res) {
        if(res.authSetting['scope.userInfo'] === true) {
          wx.getUserInfo({
            lang: 'zh_CN',
            success: function (res) {
              that.setData({
                userInfo: res.userInfo
              })
            }
          })
        }
      }
    })


    
    
  },
  bindGetUserInfo: function(e) {
    console.log(e.detail.userInfo)
    if(e.detail.userInfo) {
      this.setData({
        userInfo: e.detail.userInfo
      })
    }
  }
})